package org.smr.ministore.service;

import org.smr.ministore.entities.Authority;
import org.smr.ministore.entities.Role;
import org.smr.ministore.entities.User;
import org.blade.service.base.BaseService;
import org.blade.service.base.BaseBatchService;
import org.blade.service.base.PaginationQueryService;

import java.util.List;

/**
 * @author blade
 *
 */
public interface UserService extends BaseService<Long, User>,
                                        BaseBatchService<Long, User>,
                                        PaginationQueryService<Long, User> {

    /**
     * 根据用户名查询
     * @param userName
     * @return
     */
    public User queryByUserName( String userName );

    /**
     * 根据用户名查询用户数
     * @param userName
     * @return
     */
    public Long getCountByUserName( String userName );


    /**
     * 根据用户Id查询角色
     * @param userId
     * @return
     */
    List<Role> getRoleByUser( Long userId );


    /**
     * 根据用户Id查询权限
     * @param userId
     * @return
     */
    List<Authority> getAuthoritiesByUser(  Long userId );

    /**
     * 根据电话查询
     * @param mobilePhone
     * @return
     */
    User queryByMobile(String mobilePhone );

}
